import request from '@/api/request';

/**
 * 部门详情
 * @param {*} query 参数
 * @returns 返回Promise对象
 */
 export const departmentDetailExtendApi = query => {
    return request({
        url: '/api/mgt/department/getDetailExtend',
        method: 'get',
        params: query,
        isLoading: true
    });
};

/**
 * 组织部门列表
 * @param {*} query 参数
 * @returns 返回Promise对象
 */
 export const departmentListByOrgIdApi = query => {
    return request({
        url: '/api/mgt/department/listByOrgId',
        method: 'get',
        params: query,
        isLoading: true
    });
};

/**
 * 启用的组织部门
 * @param {*} query 参数
 * @returns 返回Promise对象
 */
export const departmentListEnabledByOrgIdApi = query => {
    return request({
        url: '/api/mgt/department/listEnabledByOrgId',
        method: 'get',
        params: query,
        isLoading: true
    });
};

/**
 * 添加部门
 * @param {*} query 参数
 * @returns 返回Promise对象
 */
 export const departmentSaveApi = query => {
    return request({
        url: '/api/mgt/department/save',
        method: 'post',
        data: query,
        isLoading: true
    });
};

/**
 * 编辑部门
 * @param {*} query 参数
 * @returns 返回Promise对象
 */
 export const departmentEditApi = query => {
    return request({
        url: '/api/mgt/department/edit',
        method: 'put',
        data: query,
        isLoading: true
    });
};

/**
 * 获取用户所属部门（标记选中的）
 * @param {*} query 参数
 * @returns 返回Promise对象
 */
export const departmentListByUserIdApi = query => {
    return request({
        url: '/api/mgt/department/listByUserId',
        method: 'get',
        params: query,
        isLoading: true
    });
};

/**
 * 删除部门
 * @param {*} query 参数
 * @returns 返回Promise对象
 */
export const departmentRemoveApi = query => {
    return request({
        url: '/api/mgt/department/removeByIds',
        method: 'delete',
        params: query,
        isLoading: true
    });
};
